package net.fxug.hokuriku.chocolat.service.socket.data
{


    public class SocketData
    {
        public function SocketData()
        {
        }

        public static function getSocketDataForMessage(message:String, vote:String, name:String = ""):XML
        {
            name = SocketData.varidate(name);
            message = SocketData.varidate(message);

            //TODO voteEnabledの解決が必要

            var xml:XML = <message_info>
                    <user_name>{name}</user_name>
                    <message>{message}</message>
                    <vote>{vote}</vote>
                    <voteEnabled>{true}</voteEnabled>
                </message_info>;

            return xml;
        }

        public static function varidate(str:String):String
        {
            str.replace("<", "&gt;");
            str.replace(">", "&lt;");

            return str;
        }
    }
}